package middleware

import (
	"bytes"
	"github.com/gin-gonic/gin"
)

type AccessLogWriter struct {
	gin.ResponseWriter
	body *bytes.Buffer
}

func (w AccessLogWriter) Write(p []byte) (int, error) {
	if n, err := w.body.Write(p); err != nil {
		return n, err
	}
	return w.ResponseWriter.Write(p)
}

func AccessLog() gin.HandlerFunc {
	return func(c *gin.Context) {
		//bodyWriter := &AccessLogWriter{
		//	ResponseWriter: c.Writer,
		//	body:           bytes.NewBufferString(""),
		//}
		//c.Writer = bodyWriter
		//beginTime := time.Now().Unix()
		//c.Next()
		//endTime:= time.Now().Unix()
		//
	}
}
